% preamble.tex

\usepackage{lmodern}
\usepackage{xeCJK}

\usetheme{CambridgeUS} % try Madrid, Pittsburgh
\usecolortheme{beaver}
\usefonttheme[]{serif} % try "professionalfonts"

\setbeamertemplate{itemize items}[default]
\setbeamertemplate{enumerate items}[default]

\usepackage{amsmath, amsfonts, latexsym, mathtools}
\newcommand{\set}[1]{\{#1\}}
\newcommand{\bset}[1]{\big\{#1\big\}}
\newcommand{\Bset}[1]{\Big\{#1\Big\}}
\DeclareMathOperator*{\argmin}{\arg\!\min}

\definecolor{bgcolor}{rgb}{0.95,0.95,0.92}

\newcommand{\incell}[2]{\begin{tabular}[c]{@{}c@{}}#1\\ #2\end{tabular}}

\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\newcommand{\hStatex}[0]{\vspace{5pt}}

\renewcommand{\today}{\number\year 年\number\month 月\number\day 日}

\usepackage{hyperref}
\hypersetup{
  colorlinks = flase,
  linkcolor = blue,
  filecolor = magenta,      
  urlcolor = teal,
}

% colors
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\redoverlay}[2]{\textcolor<#2>{red}{#1}}
\newcommand{\gray}[1]{\textcolor{gray}{#1}}
\newcommand{\green}[1]{\textcolor{green}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newcommand{\blueoverlay}[2]{\textcolor<#2>{blue}{#1}}
\newcommand{\teal}[1]{\textcolor{teal}{#1}}
\newcommand{\purple}[1]{\textcolor{purple}{#1}}
\newcommand{\cyan}[1]{\textcolor{cyan}{#1}}

% color box
\newcommand{\rbox}[1]{\red{\boxed{#1}}}
\newcommand{\gbox}[1]{\green{\boxed{#1}}}
\newcommand{\bbox}[1]{\blue{\boxed{#1}}}
\newcommand{\pbox}[1]{\purple{\boxed{#1}}}

\usepackage{listings}
\usepackage{xcolor}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\lstdefinestyle{compstyle}{
  backgroundcolor=\color{backcolour},   
  commentstyle=\color{codegreen},
  keywordstyle=\color{magenta},
  numberstyle=\tiny\color{codegray},
  stringstyle=\color{codepurple},
  basicstyle=\ttfamily\footnotesize,
  breakatwhitespace=false,         
  breaklines=true,                 
  captionpos=b,                    
  keepspaces=true,                 
  numbers=left,                    
  numbersep=5pt,                  
  showspaces=false,                
  showstringspaces=false,
  showtabs=false,                  
  tabsize=2
}
\lstset{style=compstyle}

\usepackage{pifont}
\usepackage{wasysym}

\usepackage{savesym}
\savesymbol{checkmark} % checkmark defined in dingbat
\usepackage{dingbat}

\newcommand{\cmark}{\green{\ding{51}}}
\newcommand{\xmark}{\red{\ding{55}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% for fig without caption: #1: width/size; #2: fig file
\newcommand{\fig}[2]{
  \begin{figure}[htp]
    \centering
    \includegraphics[#1]{#2}
  \end{figure}
}

% for fig with caption: #1: width/size; #2: fig file; #3: caption
\newcommand{\figcap}[3]{
  \begin{figure}[htp]
    \centering
    \includegraphics[#1]{#2}
    \caption{#3}
  \end{figure}
}

\newcommand{\lset}{\mathcal{L}_{\textsl{Set}}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\usepackage{tabu}

\DeclareRobustCommand{\stirling}{\genfrac\{\}{0pt}{}}
\newcommand{\cnum}[1]{\blue{#1}} % \textcircled{1}
\newcommand{\composition}[2]{\left( {#1 \choose #2} \right)}
\newcommand{\setpartition}[2]{\left\{ #1 \atop #2 \right\}}
\newcommand{\partition}[2]{\left| #1 \atop #2 \right|}

\newcommand{\thankyou}{
\begin{frame}[noframenumbering]{}
  \fig{width = 0.50\textwidth}{figs/thankyou.png}
\end{frame}
}

\newcommand{\intkw}{\text{\bf int}}
\newcommand{\floatkw}{\text{\bf float}}
\newcommand{\mainkw}{\text{\bf main}}
\newcommand{\voidkw}{\text{\bf void}}
\newcommand{\id}{\text{\bf id}}
\newcommand{\ifkw}{\text{\bf if}}
\newcommand{\thenkw}{\text{\bf then}}
\newcommand{\elsekw}{\text{\bf else}}
\newcommand{\comparison}{\text{\bf comparison}}
\newcommand{\relop}{\text{\bf relop}}
\newcommand{\ws}{\text{\textcolor{gray}{\bf ws}}}
\newcommand{\num}{\text{\bf num}}
\newcommand{\intnum}{\text{\bf integer}}
\newcommand{\floatnum}{\text{\bf real}}
\newcommand{\assign}{\text{\bf assign}}
\newcommand{\literal}{\text{\bf literal}}
\newcommand{\comment}{\text{\bf comment}}
\newcommand{\lp}{\text{\bf LP}}
\newcommand{\rp}{\text{\bf RP}}
\newcommand{\lb}{\text{\bf LB}}
\newcommand{\rb}{\text{\bf RB}}
\newcommand{\semicolon}{\text{\bf SC}}
\newcommand{\blank}{\text{\bf blank}}
\newcommand{\tab}{\text{\bf tab}}
\renewcommand{\line}{\text{\bf newline}}

\newcommand{\rel}[1]{\xrightarrow{#1}}